/*
 * #%L
 * SwiftUICommonUtilities
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2011 - 2012 Linkwithweb
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-3.0.html>.
 * #L%
 */
/**
 * 
 */
package com.linkwithweb.products.swiftui.dataobject;

/**
 * DROP TABLE IF EXISTS `automata`.`frm_form_fields`;
CREATE TABLE  `automata`.`frm_form_fields` (
  `FIELD_KEY` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `FIELD_ID` varchar(45) NOT NULL,
  `FIELD_NAME` varchar(45) NOT NULL,
  `FORM_ID` varchar(45) NOT NULL,
  `FIELD_DESCRIPTION` varchar(45) NOT NULL,
  `FIELD_LABEL` varchar(45) NOT NULL,
  `FIELD_DEFAULT_VALUE` varchar(45) NOT NULL,
  `FIELD_TYPE` varchar(45) NOT NULL,
  `FIELD_FORMULAE` varchar(45) NOT NULL,
  `EDITABLE` tinyint(1) NOT NULL,
  `DISPLAYABLE` tinyint(1) NOT NULL,
  `TRUE_VALUE` varchar(45) NOT NULL,
  `FALSE_VALUE` varchar(45) NOT NULL,
  `REF_TABLE_ID` varchar(45) NOT NULL,
  `REF_TABLE_KEY_COLUMN` varchar(45) NOT NULL,
  `REF_TABLE_VALUE_COLUMN` varchar(45) NOT NULL,
  `FIELD_DEFAULT_FORMAT` varchar(45) NOT NULL,
  `IDENTIFIER` varchar(45) NOT NULL,
  `IDENTIFIER_ROLE` varchar(45) NOT NULL,
  `CREATED_BY` int(10) unsigned NOT NULL,
  `CREATED_DATE` datetime NOT NULL,
  `MODIFIED_BY` int(10) unsigned NOT NULL,
  `MODIFIED_DATE` datetime NOT NULL,
  FIELD_COLSPAN integer default 1.
  DISPLAY_ORDER integer default 1.
  PRIMARY KEY (`FIELD_KEY`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 * 
 * @author ashwin kumar
 *
 */
public class FrameworkFormField extends BaseDataObject {
	private long fieldKey = -1;
	private String fieldId = "";
	private String formId = "";
	private String fieldName = "";
	private String fieldDescription = "";
	private String fieldLabel = "";
	private String fieldDefaultValue = "";
	private String fieldType = "";
	private String fieldFormulae = "";
	private boolean editable = true;
	private boolean displayable = true;
	private boolean isRequired = false;
	private String trueValue = "";
	private String falseValue = "";
	private String refTableId = "";
	private String refTableKeyColumn = "";
	private String refTableValueColumn = "";
	private String fieldDefaultFormat = "";
	private int fieldColspan = 1;
	private int displayOrder = 1;
	/**
	 * @return the fieldKey
	 */
	public long getFieldKey() {
		return fieldKey;
	}
	/**
	 * @param fieldKey the fieldKey to set
	 */
	public void setFieldKey(long fieldKey) {
		this.fieldKey = fieldKey;
	}
	/**
	 * @return the fieldId
	 */
	public String getFieldId() {
		return fieldId;
	}
	/**
	 * @param fieldId the fieldId to set
	 */
	public void setFieldId(String fieldId) {
		this.fieldId = fieldId;
	}
	/**
	 * @return the formId
	 */
	public String getFormId() {
		return formId;
	}
	/**
	 * @param formId the formId to set
	 */
	public void setFormId(String formId) {
		this.formId = formId;
	}
	
	/**
	 * @return
	 */
	public String getFieldName() {
		return fieldName;
	}
	/**
	 * @param fieldName
	 */
	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}
	/**
	 * @return the fieldDescription
	 */
	public String getFieldDescription() {
		return fieldDescription;
	}
	/**
	 * @param fieldDescription the fieldDescription to set
	 */
	public void setFieldDescription(String fieldDescription) {
		this.fieldDescription = fieldDescription;
	}
	/**
	 * @return the fieldLabel
	 */
	public String getFieldLabel() {
		return fieldLabel;
	}
	/**
	 * @param fieldLabel the fieldLabel to set
	 */
	public void setFieldLabel(String fieldLabel) {
		this.fieldLabel = fieldLabel;
	}
	/**
	 * @return the fieldDefaultValue
	 */
	public String getFieldDefaultValue() {
		return fieldDefaultValue;
	}
	/**
	 * @param fieldDefaultValue the fieldDefaultValue to set
	 */
	public void setFieldDefaultValue(String fieldDefaultValue) {
		this.fieldDefaultValue = fieldDefaultValue;
	}
	/**
	 * @return the fieldType
	 */
	public String getFieldType() {
		return fieldType;
	}
	/**
	 * @param fieldType the fieldType to set
	 */
	public void setFieldType(String fieldType) {
		this.fieldType = fieldType;
	}
	/**
	 * @return the fieldFormulae
	 */
	public String getFieldFormulae() {
		return fieldFormulae;
	}
	/**
	 * @param fieldFormulae the fieldFormulae to set
	 */
	public void setFieldFormulae(String fieldFormulae) {
		this.fieldFormulae = fieldFormulae;
	}
	/**
	 * @return the editable
	 */
	public boolean isEditable() {
		return editable;
	}
	/**
	 * @param editable the editable to set
	 */
	public void setEditable(boolean editable) {
		this.editable = editable;
	}
	/**
	 * @return the displayable
	 */
	public boolean isDisplayable() {
		return displayable;
	}
	/**
	 * @param displayable the displayable to set
	 */
	public void setDisplayable(boolean displayable) {
		this.displayable = displayable;
	}
	/**
	 * @return the trueValue
	 */
	public String getTrueValue() {
		return trueValue;
	}
	/**
	 * @param trueValue the trueValue to set
	 */
	public void setTrueValue(String trueValue) {
		this.trueValue = trueValue;
	}
	/**
	 * @return the falseValue
	 */
	public String getFalseValue() {
		return falseValue;
	}
	/**
	 * @param falseValue the falseValue to set
	 */
	public void setFalseValue(String falseValue) {
		this.falseValue = falseValue;
	}
	/**
	 * @return the refTableId
	 */
	public String getRefTableId() {
		return refTableId;
	}
	/**
	 * @param refTableId the refTableId to set
	 */
	public void setRefTableId(String refTableId) {
		this.refTableId = refTableId;
	}
	/**
	 * @return the refTableKeyColumn
	 */
	public String getRefTableKeyColumn() {
		return refTableKeyColumn;
	}
	/**
	 * @param refTableKeyColumn the refTableKeyColumn to set
	 */
	public void setRefTableKeyColumn(String refTableKeyColumn) {
		this.refTableKeyColumn = refTableKeyColumn;
	}
	/**
	 * @return the refTableValueColumn
	 */
	public String getRefTableValueColumn() {
		return refTableValueColumn;
	}
	/**
	 * @param refTableValueColumn the refTableValueColumn to set
	 */
	public void setRefTableValueColumn(String refTableValueColumn) {
		this.refTableValueColumn = refTableValueColumn;
	}
	/**
	 * @return the fieldDefaultFormat
	 */
	public String getFieldDefaultFormat() {
		return fieldDefaultFormat;
	}
	/**
	 * @param fieldDefaultFormat the fieldDefaultFormat to set
	 */
	public void setFieldDefaultFormat(String fieldDefaultFormat) {
		this.fieldDefaultFormat = fieldDefaultFormat;
	}
	/**
	 * @return
	 */
	public int getFieldColspan() {
		return fieldColspan;
	}
	/**
	 * @param fieldColspan
	 */
	public void setFieldColspan(int fieldColspan) {
		this.fieldColspan = fieldColspan;
	}
	/**
	 * @return the displayOrder
	 */
	public int getDisplayOrder() {
		return displayOrder;
	}
	/**
	 * @param displayOrder the displayOrder to set
	 */
	public void setDisplayOrder(int displayOrder) {
		this.displayOrder = displayOrder;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((fieldId == null) ? 0 : fieldId.hashCode());
		result = prime * result + ((formId == null) ? 0 : formId.hashCode());
		return result;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FrameworkFormField other = (FrameworkFormField) obj;
		if (fieldId == null) {
			if (other.fieldId != null)
				return false;
		} else if (!fieldId.equals(other.fieldId))
			return false;
		if (formId == null) {
			if (other.formId != null)
				return false;
		} else if (!formId.equals(other.formId))
			return false;
		return true;
	}
	
	public String getCapitalCaseLabel(){
		return fieldLabel;
	}
	/**
	 * @return the isRequired
	 */
	public boolean isRequired() {
		return isRequired;
	}
	/**
	 * @param isRequired the isRequired to set
	 */
	public void setRequired(boolean isRequired) {
		this.isRequired = isRequired;
	}
	
	
	
	
}
